import React from 'react';
import { DatePicker, Space,Input } from 'antd';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
interface Props{

}
const { Search } = Input;
function TimeList(props: Props) {
    
    const { RangePicker } = DatePicker;


const onRangeChange = (dates: null | (Dayjs | null)[], dateStrings: string[]) => {
  if (dates) {
    console.log('From: ', dates[0], ', to: ', dates[1]);
    console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
  } else {
    console.log('Clear');
  }
};

const rangePresets: {
  label: string;
  value: [Dayjs, Dayjs];
}[] = [
  { label: '最近一周', value: [dayjs().add(-7, 'd'), dayjs()] },
  { label: '最近一个月', value: [dayjs().add(-30, 'd'), dayjs()] },
  { label: '最近三个月', value: [dayjs().add(-90, 'd'), dayjs()] },
        ];
  const onSearch = (value: string) => console.log(value);
    return (
        <div className='time-list'>
             
             发布日期                                             
    <RangePicker presets={rangePresets} onChange={onRangeChange} />
    <Search placeholder="请输入关键词" allowClear onSearch={onSearch} style={{ width: 200 }} />
        </div>
    );

}

export default TimeList;